package pl.drypisy;

import java.awt.image.BufferedImage;

/**
 * Created with IntelliJ IDEA.
 * User: adam
 * Date: 20.01.13
 * Time: 00:58
 * To change this template use File | Settings | File Templates.
 */
public class CropProcess extends ImageProcess {
    private int width;
    private int height;
    private int x, y;
    public void setPoints(int x1, int y1, int x2, int y2)
    {
        this.x = Math.min(x1,x2);
        this.y = Math.min(y1,y2);
        x2 = Math.max(x1,x2);
        y2 = Math.max(y1,y2);
        width = x2 - x1;
        height = y2 - y1;
    }
    @Override
    public BufferedImage process(BufferedImage img) {
        return img.getSubimage(x, y, width, height);
    }

    @Override
    protected void getOriginalCoordinates(int x, int y, double[] out) {
        //To change body of implemented methods use File | Settings | File Templates.
    }
}
